//
//  RecommendHeaderScrollView.m
//  Car
//
//  Created by apple on 15/9/17.
//  Copyright (c) 2015年 朱鸿儒. All rights reserved.
//

#import "RecommendHeaderScrollView.h"

@implementation RecommendHeaderScrollView

//  重写初始化方法
- (instancetype)initWithFrame:(CGRect)frame imageArray:(NSMutableArray *)imageArray delegate:(id)delagete timer:(NSTimeInterval)timer action:(SEL)action {
    
    self = [super initWithFrame:frame];
    
    if (self) {
        
        self.backgroundColor = [UIColor yellowColor];
        
        //  滑动的大小
        self.contentSize = CGSizeMake(kWidth * imageArray.count, 0);
        //  整页滑动
        self.pagingEnabled = YES;
        //  边界回弹
        self.bounces = NO;
        
        self.delegate = delagete;
        
        NSLog(@"%ld=====", imageArray.count);
        
        for (int i = 0; i < imageArray.count; i++) {
            
            self.tapImageView = [[TapImageView alloc] initWithFrame:CGRectMake(i * kWidth, 0, kWidth, self.frame.size.height) target:delagete action:action];
            
            self.tapImageView.backgroundColor = [UIColor lightGrayColor];
            
            [self.tapImageView sd_setImageWithURL:[NSURL URLWithString:[imageArray objectAtIndex:i]]];
            
            [self addSubview:self.tapImageView];
            
           
        }
        

       
    }
    
    return self;
    
}
















@end
